import request from '@/utils/request.js'

// 登录
export const oAuthLogin = ({ username, password, kaptchaKey, captchaCode }) =>
  request.post('/api/oauth/login', { username, password, kaptchaKey, captchaCode })

export const oAuthKaptCha = () => request.get('/api/oauth/kaptcha')

export const oAuthRegister = ({ email, password, repeatPass, code }) =>
  request.post('/api/oauth/register', { email, password, repeatPass, code })

export const oAuthEmail = receiver => request.get('/api/oauth/email', { params: { receiver } })

export const oAuthTokenParseToken = token => request.get('/api/oauth/token/parseToken', { params: { token } })

export const oAuthTokenRefreshToken = (email, token) =>
  request.get('/api/oauth/token/refreshToken', { params: { email, token } })

export const oAuthLogout = ({ email, username }) => request.post('/api/oauth/logout', { email, username })
